using CommandLine;
using NUnit.Framework;
using TwitterBand;

namespace host.tests
{
    [TestFixture]
    public class OptionsTests
    {
        private CommandLineParser commandLine;
        private Options options;

        [SetUp]
        public void Setup() {
            commandLine = new CommandLineParser();
            options = new Options();
        }

        [Test]
        public void Query_ist_obligatorisch_short() {
            Assert.That(commandLine.ParseArguments(new[] {"-q myquery"}, options));
            Assert.That(options.Query, Is.EqualTo(" myquery"));
        }

        [Test]
        public void Query_ist_obligatorisch_long() {
            Assert.That(commandLine.ParseArguments(new[] {"--query=myquery"}, options));
            Assert.That(options.Query, Is.EqualTo("myquery"));
        }

        [Test]
        public void Always_on_top_ist_optional_und_deaktiviert() {
            Assert.That(commandLine.ParseArguments(new[] {"-qx"}, options));
            Assert.That(options.AlwaysOnTop, Is.False);
        }

        [Test]
        public void Always_on_top_kann_aktiviert_werden_short() {
            Assert.That(commandLine.ParseArguments(new[] {"-qx", "-a"}, options));
            Assert.That(options.AlwaysOnTop, Is.True);
        }

        [Test]
        public void Always_on_top_kann_aktiviert_werden_long() {
            Assert.That(commandLine.ParseArguments(new[] {"-qx", "--alwaysontop"}, options));
            Assert.That(options.AlwaysOnTop, Is.True);
        }
    }
}